/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: lucky
 * Date: 2022-08-04
 * Time: 9:40
 */

//interface  Runing{
//    void run();
//}
//interface Eating{
//    void eat();
//}
//interface Cat extends Runing,Eating {
//
//}
//class People implements Cat{
//   // 需要重写这个接口的所有抽象方法
//    @Override
//    public void run() {
//
//    }
//    @Override
//    public void eat() {
//
//    }
//}

class Fraction implements Cloneable{
    public double a = 99;

    @Override
    protected Object clone() throws CloneNotSupportedException {
        return super.clone();
    }
}
class Student implements Cloneable{
    public Fraction fraction = new Fraction();

    @Override
    protected Object clone() throws CloneNotSupportedException {
//        return super.clone();
        Student student = (Student) super.clone();
        student.fraction = (Fraction) this.fraction.clone();
        return student;
    }
}
public class Demo1 {
    public static void main(String[] args) throws CloneNotSupportedException {
        Student student1 = new Student();
        Student student2 = (Student)student1.clone();
        System.out.println("student1修改之前的分数");
        System.out.println(student1.fraction.a);
        System.out.println(student2.fraction.a);
        student2.fraction.a = 59;
        System.out.println("student1修改后的分数");
        System.out.println(student1.fraction.a);
        System.out.println(student2.fraction.a);

    }
}
